import 'dart:convert';
import 'dart:typed_data';

import 'package:crypto/crypto.dart';

///使用md5加密

extension SecretString on String {
  String get md5String {
    Uint8List content = const Utf8Encoder().convert(this);
    Digest digest = md5.convert(content);
    return digest.toString();
  }

  void h() {}

  Digest hmacSHA1(String content, String key) {
    var _key = utf8.encode(key);
    var bytes = utf8.encode(content);
    //使用token对字典加密
    var hmacSha1 = Hmac(sha1, _key);
    Digest sha1Result = hmacSha1.convert(bytes);
    return sha1Result;
  }
}
